/*
 * @Author: wujian
 * @Date: 2023-12-25 17:14:59
 * @LastEditors: wujian
 * @LastEditTime: 2023-12-25 19:50:42
 * @FilePath: \qiankun\vue-project\src\router\index.js
 * @Description:
 * @email: 281919544@qq.com
 * Copyright (c) 2023 by wujian, All Rights Reserved.
 */
import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',

      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/ceshi',
      name: 'ceshi',
      component: () => import('../views/test/ceshi.vue')
    }
  ]
});
//主应用使用的嵌套路由
router.beforeEach((to, from, next) => {
  console.log(to.query,'to.path*************');
  // 手动修改history的state
  if (!history.state.current) {
    Object.assign(history.state, {
      current: from.fullPath
    });
  }
  next();
});
export default router;
